package com.lagou.edu.controller;

import com.lagou.edu.service.CodeService;
import com.lagou.edu.utils.Result;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author grung
 * @Date 2020/10/24 15:13
 * @Version 1.0
 */

@RestController
@RequestMapping("/code")
public class CodeController {


    @Reference
    private CodeService codeService;


    @GetMapping("/create/{email}")
    public Result create(@PathVariable("email") String email){

        return codeService.create(email);
    }

    @RequestMapping("/validate/{email}/{code}")
    public Integer validate(@PathVariable("email")String email,@PathVariable("code")String code){

        return codeService.vaildate(email,code);
    }
}
